#ifndef __ADS1100_H
#define __ADS1100_H

#include "adciic.h"

extern u16   vol_raw;
extern float ads_vol;

//ADS1100's register -->

//[Bit 7]
#define  ADC_STANDBY     0   //No conversion is taking place, and the result of the last conversion is available in the output register.
#define  ADC_BUSY        1   //AD converter is busy, and a conversion is taking place.

//[Bits 6,5] must be set to zero.

//[Bit 4]
#define  ADC_CS_OFF      1   //The ADS1100 is in single conversion mode.
#define  ADC_CS_ON       0   //The ADS1100 is in continuous conversion mode.

//[Bit 3,2]
#define  ADC_DR_8SPS     3
#define  ADC_DR_16SPS    2
#define  ADC_DR_32SPS    1
#define  ADC_DR_128SPS   0

//[Bit 1,0]
#define  ADC_PGA_1GAIN   0
#define  ADC_PGA_2GAIN   1
#define  ADC_PGA_4GAIN   2
#define  ADC_PGA_8GAIN   3

// <--


//ADS1100ADx address 
#define  ADS_AD0_ADDRESS     0x48  //ADS1100AD0  default using
#define  ADS_AD1_ADDRESS     0x49  //ADS1100AD1
#define  ADS_AD2_ADDRESS     0x4A  //ADS1100AD2
#define  ADS_AD3_ADDRESS     0x4B  //ADS1100AD3
#define  ADS_AD4_ADDRESS     0x4C  //ADS1100AD4
#define  ADS_AD5_ADDRESS     0x4D  //ADS1100AD5
#define  ADS_AD6_ADDRESS     0x4E  //ADS1100AD6
#define  ADS_AD7_ADDRESS     0x4F  //ADS1100AD7


//ADS1100 Functions
u8     ADS_Init(u8 ADS_ADx,u8 ADC_CS, u8 ADC_SPS, u8 ADC_GAIN);
u8     ADS_UpdateReg(u8 ADS_ADDRESS);

u8     ADS_Write(u8 ADS_ADDRESS,u8 data);
u8     ADS_Read(u8 ADS_ADDRESS);
float  ADS_GetVol(void);

u8     Li_Power_Cal(void);

#endif 




